<template>
    <div class="login">
        <el-row class="login-row">
            <el-col :span="6">
                <el-card>
                    <div class="tital">zingon文档系统激活</div>
                    <div class="login-btn">
                        <el-button type="primary" @click="submitForm">激活</el-button>
                    </div>
                </el-card>
            </el-col>
        </el-row>
    </div>
</template>

<script>
import { activeUser } from "../../api";
import { Notification, MessageBox } from "element-ui";

export default {
  props: ["token"],
  data: function() {
    return {
     
    };
  },
  methods: {
    submitForm() {
        let _this =this;
        activeUser(this.token).then(function(resp){
            if(resp.errmsg == 'ok' && resp.data == 1){
                MessageBox.alert("激活成功请前往登陆页面。", "激活成功", {
                  confirmButtonText: "确定",
                  callback: action => {
                    _this.$router.push({ path: "/login" });
                  }
                });
            }
        }).catch(function(e){
            if(e == '0x0006'){
                Notification.error("激活链接过期请联系管理员，zingon@aliyun.com");
            }
        });
    }
  }
};
</script>

<style scoped>
.tital {
  text-align: center;
  font-size: 26px;
  margin-bottom: 6%;
}

.login-btn button {
  width: 100%;
  height: 36px;
}

.login {
  display: flex;
  align-items: center;
  height: 100%;
}

.login-row {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

.login-register {
  text-align: right;
  margin-bottom: 10px;
  margin-right: 10px;
}
</style>